package com.wlyuan.open.scanner.application.handler.table;

import com.wlyuan.open.scanner.application.annotation.TableScannerName;
import com.wlyuan.open.scanner.constant.TableEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.var;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

/**
 * @author lijing
 * @description
 */
@Slf4j
@Service
@RequiredArgsConstructor
@TableScannerName(isDefault = true)
public class DefaultTableToIncrHandler extends BaseTableToIncrHandler {

    @Override
    public List<String> handler(String tableName, String businessParams, String beforeData) {
        var table = TableEnum.fromName(tableName);
        return Optional.ofNullable(table).map(t -> Arrays.asList(t.getName())).orElse(null);
    }
}
